var app = getApp()
Component({
  lifetimes: {
    ready() {
      this.getData()
    }
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    list: [{
        title: "活跃值",
        count: 0,
        url: 'sign_in_subscribe_active_value',
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_active.png"
      },
      {
        title: "股权",
        count:0,
        url: "sign_in_subscribe_stock_rights",
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_stocks.png"
      },
      {
        title: "元宝枫",
        count: 0,
        url: "sign_in_subscribe_acer_truncatum",
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_ingot.png"
      },
      {
        title: "有效用户",
        url: "sign_in_subscribe_user",
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_user.png"
      },
      {
        title: "奖励记录",
        url: "sign_in_subscribe_earnings",
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_rewards.png"
      },
      // {
      //   title: "钱包地址",
      //   url: 'sign_in_subscribe_wallet',
      //   src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_wallet.png"
      // },
      {
        title: "我的团队",
        url: 'sign_in_subscribe_team',
        src: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/sign_in_subscribe/sign_in_team.png"
      }
    ],

    grade_name:"",
    user_name:"",
    avatar_image:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getData() {
      app._getNetWork({
        url: app.getNetAddresss("plugin.sign-buy.frontend.sign-buy-page.member"),
        success: (resdata) => {
          let {
            data,
            result,
            msg
          } = resdata.data;
          console.log(data)
          if (result == 0) {
            return app.tips(msg)
          }


          let {
            usable,
            froze,
            yuan_bao_feng,
            stock_total,
            is_vip,
            grade_name,
            user_name,
            avatar_image
          } = data;
          console.log(usable)
          console.log(stock_total)
          console.log(yuan_bao_feng)

          this.setData({
            ["list[0].count"]:usable,
            ["list[1].count"]:stock_total,
            ["list[2].count"]:yuan_bao_feng,
            froze,
            is_vip,
            grade_name,
            user_name,
            avatar_image
          })

        }
      })
    },
    link(e) {
      if(e.currentTarget.dataset.url == 'code'){
        wx.navigateTo({
          url: `/packageF/sign_in_subscribe/${e.currentTarget.dataset.url}/${e.currentTarget.dataset.url}?type=1`,
        })
      }else{
        wx.navigateTo({
          url: `/packageF/sign_in_subscribe/${e.currentTarget.dataset.url}/${e.currentTarget.dataset.url}`,
        })
      }
  
    }
  }
})